feat(sqlserverreceiver): Port v0.150.0 with passfile auth, gap metrics, and top applications - #618
Closed
Klarsen04 wants to merge 4 commits into
Closed
feat(sqlserverreceiver): Port v0.150.0 with passfile auth, gap metrics, and top applications#618Klarsen04 wants to merge 4 commits into
Klarsen04 wants to merge 4 commits into
Conversation
… top query support Port the SQL Server receiver from otel-bump-v0.150.0, adding: - Query sample collection from sys.dm_exec_requests - Top query collection from sys.dm_exec_query_stats - SQL and query plan obfuscation with DataDog obfuscator - LRU caching for delta computation and query plan caching - Session status and wait type detection - Independent collection intervals for top queries - Priority queue implementation for query ranking - Service instance ID generation - Integration test scaffolding and testdata - Logs builder for event emission - Wait stats support and testdata Manual metadata generation for v0.124.0 compatibility: - Dependency adjustments to match aws-cwa-dev (v0.124.0/v1.30.0) - Generated metadata files for new log events - Config schema updates
Add passfile authentication (ADO connection string format): - Password resolution from passfile matching server, port, and user ID - Support for quoted values, semicolons in passwords, escaped quotes - Key synonyms (pwd/password, uid/user id, data source/server) - Permission validation (0600/0400 on Linux) - Comprehensive test coverage for matching, synonyms, special chars - Integration with config validation and factory connection building Add DBI gap metrics for parity with MySQL/PostgreSQL: - Gap 1: I/O queue metrics (sqlserver.database.io.stall_queued.read/write) - Resource governor read/write stall time from sys.dm_io_virtual_file_stats - Gap 2: Session state metrics (sqlserver.session.count) - Active sessions by status and command type - Tracks running, sleeping, dormant states - Collects from sys.dm_exec_requests and sys.dm_exec_sessions Query improvements for Database Insights: - Add database_name to top query events (db.namespace attribute) - Fix session_status constant usage in scraper - Add wait_category_test.go for wait type categorization coverage - Update test expectations and testdata for all query changes
Add sqlserver.application.name attribute to query samples to enable 'Top Applications' dimension, achieving full parity with RDS Performance Insights. Changes: - Collect program_name from sys.dm_exec_sessions - Add sqlserver.application.name attribute to metadata - Extract and emit program_name in query sample events - Update generated metadata code and tests - Update test data files This enables tracking which client applications generate the most database load, improving troubleshooting and cost attribution. Matches RDS Performance Insights dimensions: - Top SQL, Top waits, Top hosts, Top users, Top applications, Top databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue
The CloudWatch Agent's SQL Server receiver (fork) needed several enhancements to support Database Insights (DBI): upstream v0.150.0 features (query sample collection, top query tracking via sys.dm_exec_query_stats), passfile-based authentication, and application name attribute for "Top Applications" dimension.
Description of changes
Port upstream v0.150.0 — Brings in query sample collection from sys.dm_exec_requests and sys.dm_exec_sessions, top query collection from sys.dm_exec_query_stats, SQL and query plan obfuscation (DataDog obfuscate package), LRU caching for delta computation and query plan caching, priority queue for top-N query selection, direct-connect support for Linux SQL Server, and trace propagation support.
Passfile support — Implements ADO connection string passfile authentication for SQL Server (the Go mssql driver has no native passfile support). Passfile contains one complete ADO connection string per line (server=host;user id=user;password=pass;port=1433), allowing secure credential storage.
Top Applications support — Adds
sqlserver.application.nameattribute extracted fromprogram_namein sys.dm_exec_sessions to enable "Top Applications" dimension. Includes self-filtering query (WHERE s.session_id != @@SPID) to exclude the monitoring session itself from query samples.License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Unit tests ported and updated across all changes (scraper_test, factory_test, config_test, queries_test, passfile_test, obfuscate_test, priority_queue_test). Expected SQL/YAML fixtures added for query sample scraping, database I/O, wait stats, and performance counters. Integration tested end-to-end with CloudWatch Agent on EC2 Windows and Linux SQL Server.